
window.callActivityPlugin = function(str,action,param1,callback) {
    cordova.exec(callback, pluginFailed, "ConfigCallName", action, [str,param1]);
    //cordova.exec(callback, pluginFailed, "Demo", "intent", [mills]);
};  
  
var pluginFailed = function(message) {  
    //alert("failed>>" + message);
}  
  
$(function() {  
    init();  
});  
  
var init = function() {  
    console.log("phonegap init!!");  
    document.addEventListener("deviceready", onDeviceReady, true);  
}  
  
var onDeviceReady = function() {
    document.addEventListener("backbutton", onBackKeyDown, false);
};

function clearLogin(){

    window.callActivityPlugin("null","dataclear","null" , function(echoValue) {

    });
}

function closeApp(){
    window.callActivityPlugin("null","actionclose","null" , function(echoValue) {

    });
}

//function shareUmeng(content,pic){
//
//    window.callActivityPlugin(content,"actionumeng",pic , function(echoValue) {
//
//    });
//}
//
//function showToast(msg){
//    window.callActivityPlugin(msg,"toast","null" , function(echoValue) {
//
//    });
//}


function jumptofriends(){
    window.callActivityPlugin("com.novem.dmqh.easemob.ui.MainActivity","activityfriends","null" , function(echoValue) {

    });
}

function jumptoChating(mobile){
    window.callActivityPlugin("com.novem.dmqh.easemob.ui.ChatActivity","activitychating",mobile , function(echoValue) {

    });
}

function getUnReadNum(){
    window.callActivityPlugin("null","actionunreadnum","null" , function(echoValue) {
          $(".ui-new-msg-2").text(echoValue+"");
    });
}


function payByAlipay(subject,body,total_fee,out_trade_no,notify_url){

    var all = body+"&&&"+total_fee + "&&&" + out_trade_no + "&&&"+notify_url;

    window.callActivityPlugin(subject,"actionpayali",all, function(echoValue) {

    });
}

//function jumpchangeLoginStatus(){
//     window.callActivityPlugin("com.novem.dmqh.GuideActivity","dataloginstatus","1122" , function(echoValue) {
//
//    });
//}

//传递登录账号
function jumpSendLoginData(str1,str2){

     window.callActivityPlugin(str1,"datasend",str2 , function(echoValue) {

    });
}

//function jumpCallUserInfo(){
//   window.callActivityPlugin("","datauserinfo", "1122" , function(echoValue) {
//      // console.log("callActivityPlugin echo>>1111====="+echoValue);
//      if(echoValue != null && echoValue != ""){
//
//          var strs = new Array(); //定义一数组
//          strs=echoValue.split(","); //字符分割
//
//          if(strs.length != 3){
//              return;
//          }
//
//          var status = strs[0];
//          var phonenum = strs[1];
//          var password = strs[2];
//
//          if(status == "false"){
//
//             $.jsonp({
//                url: 'http://dm.wjbb.com.cn:8080/api/user/user_login',
//                data: {telphone:phonenum,password:password},
//                callbackParameter: "callback",
//                       success: function (data, textStatus, xOptions) {
//                         jumpchangeLoginStatus();
//                       },
//                       error: function (xOptions,textStatus) {
//                       }
//             });
//
//          }
//      }
//       return echoValue;
//   });

//}

